<template>
    <div class="login">
      <div class="restaurant">
        <img :src="restaurant_logo" alt="" class="restaurant_pic">
        <span class="restaurant_name">{{ restaurant_name + '(' + restaurant_location + ')'}}</span>
      </div>
      <div class="customer">
        <div class="customer_pic">
          <img :src="user_pic" alt="">
        </div>
        <p class="customer_name">{{ user_name }}</p>
      </div>
      <div class="btn_login">

        <router-link :to="{ path: '/dinersNum',query:{flag:1}}">
          开始点餐
        </router-link>
      </div>
      <div class="bg"></div>
    </div>
</template>

<script>
    export default {
      data (){
        return {
          restaurant_name:'千岛湖人家',
          restaurant_location:'杭州',
          restaurant_logo:'',
          user_name:'111',
          user_pic:''
        }
      },
      methods:{

      },
      created:function () {
        this.$http.get(this.kdUrl.url_host+this.kdUrl.url_par+'&r_id=1000&table_id=105').then((res) => {
          console.log(res);
          let data = res.body
          if(!data.error_code){
            this.restaurant_name = data.data.r_info[0].r_name
            this.restaurant_location = data.data.r_info[0].r_location
            this.restaurant_logo = data.data.r_info[0].r_logo

            this.user_name = data.data.user_info.user_name
            this.user_pic = data.data.user_info.user_pic
            localStorage.setItem("kd_token",data.data.user_info.token);
            console.log('token: '+localStorage.getItem("kd_token"));

          }

        }, (err) => {
          console.log(err);
        })

      }
    }
</script>

<style scoped>
  .login{
    color: #fff;
  }
  .restaurant{
    text-align: center;
    margin: 40px auto 0;
  }
  .restaurant_pic{
    width: 40px;
    height: 40px;
    border-radius: 3px;
    vertical-align: middle;
  }
  .restaurant_name{
    padding-left: 10px;
    font-size: 20px;
    font-weight: 400;
    vertical-align: middle;

  }
  .customer{
    text-align: center;
    margin-top: 80px;
  }

  .customer_pic img{
    height: 100px;
    width: 100px;
    border-radius: 50%;
  }
  .customer_name{
    padding-top: 30px;
    font-size: 20px;
  }
  .btn_login{
    margin: 80px auto 0;
  }
  .btn_login a{
    color: #fff;
    display: block;
    margin: auto;
    width: 150px;
    height: 40px;
    background: #e02200;
    font-size: 16px;
    text-align: center;
    line-height: 40px;
    border-radius: 5px;
  }
  .bg{
    background-image: url('../assets/bg.jpg');
    -webkit-background-size: cover;
    background-size: cover;
    position: fixed;
    z-index: -1;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

</style>
